
import { _decorator, Component, Node, AssetManager, Prefab, Scene, instantiate } from 'cc';
import { ICallback, ResMgr } from './ResMgr';
const { ccclass, property } = _decorator;

export class ViewMgr {

    private static instance: ViewMgr = null!;

    static getInstance(): ViewMgr {
        if (this.instance === null) {
            this.instance = new ViewMgr();
        }

        return this.instance;
    }

    //打开复活页
    openOver(scene: Scene) {
        ResMgr.loadBundle('res', (bundle) => {
            bundle.load('View/GameRevive', Prefab, (err, prefab) => {
                let node = instantiate(prefab);
                scene.addChild(node);
            })
        }, this)
    }

    openGame(scene: Scene) {
        ResMgr.loadBundle('res', (bundle) => {
            bundle.load('View/GameView', Prefab, (err, prefab) => {
                let node = instantiate(prefab);
                scene.addChild(node);
            })
        }, this)
    }

    openStartGame(scene: Scene) {
        ResMgr.loadBundle('res', (bundle) => {
            bundle.load('View/GameStartUI', Prefab, (err, prefab) => {
                let node = instantiate(prefab);
                scene.addChild(node);
            })
        }, this)
    }
}


